//
//  CZNetWorkingTool.swift
//  sinaWeiboswift
//
//  Created by 段文杰 on 16/4/11.
//  Copyright © 2016年 段文杰. All rights reserved.
//

import UIKit
import AFNetworking


// Swift中得枚举不仅可以有成员,还可以有属性,还有可以有方法
enum HMNetworkErrorEnum: Int {
    case AccessTokenEmpty = -1
    case UidEmpty = -2
    
    var errorDescription: String {
        get {
            switch self {
            case AccessTokenEmpty: return "access_token没有值"
            case UidEmpty: return "uid没有值"
            }
        }
    }
    
    // 返回一个错误
    func error() -> NSError {
        return NSError(domain: "cn.itheima.net", code: self.rawValue, userInfo: ["errorDescription" : self.errorDescription])
    }
}

class CZNetWorkingTool: AFHTTPSessionManager {

    static  let sharInstance: CZNetWorkingTool = {
        let tool = CZNetWorkingTool()
        
        tool.responseSerializer.acceptableContentTypes?.insert("text/plain")
        
      return tool
    
    }()
        

    
    
    
}
